﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Boardgames_webproject.Models;
using Boardgames_webproject.Models.ViewModels;
using System.Data.SqlClient;


using Microsoft.Web.WebPages.OAuth;namespace Boardgames_webproject.Controllers
{
    //[Authorize(Roles="Admin")]
    public class HomeController : Controller
    {
        BoardGameRepository repository = new BoardGameRepository();

        

        public ActionResult Index()
        {
            try
            {
                AchievementVM model = new AchievementVM();
                model.achievement_list = repository.getGameAchievements(1);
                return View(model);
            }
            catch(SqlException e)
            {
                return View("Error");
            }
  


            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";

            
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your app description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}
